<!DOCTYPE html>
<!--[if IE 8]> <html lang="zh-CN" class="ie8"> <![endif]-->
<html lang="zh-CN">

	<head>
		<meta http-equiv="content-type" content="text/html; charset=utf-8" />
		<title>我的拼团</title>
		<meta content="telephone=no,email=no,address=no" name="format-detection" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
		<meta name="msapplication-tap-highlight" content="no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="wap-font-scale" content="no">
		<meta name="Keywords" content="" />
		<meta name="Description" content="" />

		<link rel="stylesheet" href="/themes/wnsc_moblie/newMobile/User/css/common.css" />
		<link rel="stylesheet" href="/themes/wnsc_moblie/newMobile/User/css/user.css" />
		<link rel="stylesheet" href="/themes/wnsc_moblie/newMobile/User/css/color-style.css" />
		<link rel="stylesheet" type="text/css" href="/themes/wnsc_moblie/Public/css/public.css">
		<link rel="stylesheet" href="/themes/wnsc_moblie/newMobile/Shop/css/dropload.css" />
		<script type="text/javascript" src="/themes/wnsc_moblie/newMobile/User/js/area/jquery.min.js"></script>
		<script type="text/javascript" src="/themes/wnsc_moblie/Public/js/common.js"></script>
		<script src="/themes/wnsc_moblie/newMobile/Shop/css/dropload.js"></script>
		<script src="/themes/wnsc_moblie/newMobile/Shop/js/layer.js"></script>
	
	</head>

	<body>
	<?php
				$agent = $_SERVER['HTTP_USER_AGENT'];
				if(strpos($agent,"Html5Plus") === false){
			?>
		<header>
			<div class="tab_nav">
				<div class="header">
					<div class="header-left">
						<a class="sb-back" href="javascript:history.back(-1)" title="返回"></a>
					</div>
					<div class="header-middle">我的拼团</div>
					<div class="header-right">
						<aside class="show-menu-btn">
							<div class="show-menu" id="show_more">
								<a href="javascript:void(0)"></a>
							</div>
						</aside>
					</div>
				</div>
			</div>
		</header>

			<mtc_include file="Public:right_nav" />
	<?php
			}
			?>
		<div class="order-box">
			<!--<div class="order-search ">
				<form id="searchForm" name="searchForm" action="/user/order/list.html" method="GET">
					<input type="hidden" name="name" value="">
					<input type="hidden" name="order_status" value="all">
					<input type="hidden" name="evaluate_status" value="all">

					<input id='name' type="text" name="name" value="" placeholder='输入商品标题或订单号'>

					<input id='order_status' type='hidden' value='all' name='order_status'>

					<input id='evaluate_status' type='hidden' value='all' name='evaluate_status'>

					<span class="num-clear hide">
			<i class="iconfont">&#xe621;</i>
		</span>
					<a href="javascript:void(0)" class="search-btn" id="searchFormSubmit">&nbsp;</a>

				</form>
			</div>-->
			<php>
				$status=$_GET['status'];
				if($status>0){
					$status=$status;
				}else{
					$status=0;
				}
			</php>
			<ul class="order-list-top">
				<li data="0" style="width: 25%;">
					<a href="javascript:void(0)" id='order_all' class='tabs- <eq name="status" value="0">on</eq>'>全部({$cccount|default='0'})</a>
				</li>
				<li data="1" style="width: 25%;">
					<a href="javascript:void(0)" id='order_unpayed' class='tabs- <eq name="status" value="1">on</eq>'>等待拼团({$wcount|default='0'})</a>
				</li>
				<li data="2" style="width: 25%;">
					<a href="javascript:void(0)" id='order_unshipped' class='tabs- <eq name="status" value="2">on</eq>'>拼团成功({$dfcount|default='0'})</a>
				</li>
				<li data="3" style="width: 25%;">
					<a href="javascript:void(0)" id='order_shipped' class='tabs- <eq name="status" value="3">on</eq>'>拼团失败({$dscount|default='0'})</a>
				</li>
				
			</ul>

			<div class="order-center-content" id="table_list">
				<div class="tablelist-append show0">
					<!--订单列表-->
				</div>
				<div class="tablelist-append show1">
					<!--订单列表-->
				</div>
				<div class="tablelist-append show2">
					<!--订单列表-->
				</div>
				<div class="tablelist-append show3">
					<!--订单列表-->
				</div>
				
			</div>
			<a href="javascript:void(0);" id="back-to-top" class="gotop hide"><img src="/themes/wnsc_moblie/Public/picture/topup.png"></a>
			<script>
				$(document).ready(function() {
					//首先将#back-to-top隐藏
					get_order_list({$_GET['status']});
					$("#back-to-top").addClass('hide');
					//当滚动条的位置处于距顶部1000像素以下时，跳转链接出现，否则消失
					$(function() {
						$(window).scroll(function() {
							if($(window).scrollTop() > 800) {
								$("#back-to-top").removeClass('hide');
							} else {
								$("#back-to-top").addClass('hide');
							}
						});
						//当点击跳转链接后，回到页面顶部位置
						$("#back-to-top").click(function() {
							$('body,html').animate({
								scrollTop: 0
							}, 600);
							return false;
						});
						$('.order-list-top li').click(function(){
							$('.order-list-top li a').removeClass('on');
							$(this).children('a').addClass('on')
							var type=$(this).attr('data');
							$('.tablelist-append').empty();
							$('.dropload-down').remove();
							get_order_list(type);
							
						})
						$('body').on('touchstart', '.edit-order',function() { 
							var type=$(this).attr('data-type');
							var order_id=$(this).attr('data-id');
							//关闭订单
							if(type=='close_order'){
								var statu = confirm("是否确认取消订单?");   
								if(!statu){    
									return false;   
								}
								$.ajax({     
									type:'POST',     
									url:'{:U("user/close_order")}',     
									data:{order_id:order_id},    
									success:function(msg){       
										if(msg.code == 1){        
											layer.msg(msg.message);
											setTimeout(window.location.href='/user/order/status/1.html',1000)
											
										}else{        
											layer.msg(msg.message);
										}           
									},     
									error:function(){ 
										layer.msg('网络故障!');
									}         
								});
							}
							//确认订单
							if(type=='queren_get'){
								var statu = confirm("是否确认收货?");   
								if(!statu){    
									return false;   
								}
								$.ajax({
									type:"post",
									url:'{:U("user/confirm_order")}',
									data:{order_id:order_id}, 
									success:function(data){
										if(data.code==1){
											layer.msg(data.message)
											setTimeout('window.location.href="/user/order/status/4.html"',1000);
										}
										if(data.code==0){
											layer.msg(data.message)
										}
									}
								});

							}
							//立即评价
							if(type=='evaluation'){
								window.location.href='/user/reviewcommodity/id/'+order_id+'.html';
							}
						});
					});
				});

				function get_order_list(type) {
					var last = 0;
					var amount = 6;
					var html='';
					var url = "{:U('user/ajax_getorder_list_pt')}";
					if(type) {
						var last = 0;
						var stauts = type;
					} else {
						var stauts = 0;
						type=0;
					}
					$('.tablelist-append').hide();
					$('.show'+type).show();
					$('#table_list').dropload({
						scrollArea: window,
						domDown: {
							domClass: 'dropload-down',
							domRefresh: '<div class="dropload-refresh">上拉加载更多</div>',
							domLoad: '<div class="dropload-load"><span class="loading"></span>加载中...</div>',
							domNoData: '<div class="dropload-noData">已无数据</div>'
						},
						loadDownFn: function(me) {
							$.ajax({
								type: 'GET',
								url: url,
								data: {
									last: last,
									amount: amount,
									stauts: stauts
								},
								dataType: 'json',
								success: function(data) {
									if(data == null) {
										me.noData();
										me.resetload();
									} else {
										$('.no-data-div').hide();
										$.each(data,function(key,value) {
											$('.show'+type).append(value)
											html+=value
										});
										last = last + amount;
									}
									// 代码执行后必须重置
									me.resetload();
								}
							});
						}
					});

				}
			</script>
		</div>
		<!--底部菜单 start-->
		<!--底部菜单 start-->
		<div style="height: 48px; line-height: 48px; clear: both;"></div>
		<mtc_include file="Public:footer" />
	</body>

</html>